{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import operator\n",
    "from enum import Enum\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import os\n",
    "os.chdir('/Users/Judith/Documents/Simtax_py/SimTax/params')\n",
    "\n",
    "# Parameters\n",
    "first_year = 2011 #First year with parameters to import\n",
    "nb_years = 6 # Number of years with parameters to import\n",
    "end_year = first_year + nb_years \n",
    "\n",
    "QC_abatment = 0.835 # Quebec's abbatment\n",
    "NRTC_age_rate = 0.15 # NRTC for age rate\n",
    "postponeOAS_bonus = 0.072 # Anual bonus for postponing OAS pensions (simulation)\n",
    "ONT_socass_exempt_rate = 0.5 # For earning income only\n",
    "\n",
    "# Loading dataset from stata\n",
    "param = dict()\n",
    "soc_ass = dict()\n",
    "soc_sol = dict()\n",
    "witb = dict()\n",
    "for i in range(2011,2017):\n",
    "    param['%s'%i] = pd.read_stata('%s_parameters_nofortran.dta'%i)\n",
    "    soc_ass['%s'%i] = pd.read_stata('%s_parameters_nofortran.dta'%i)\n",
    "    soc_sol['%s'%i] = pd.read_stata('%s_parameters_nofortran.dta'%i)\n",
    "    witb['%s'%i] = pd.read_stata('CAN/%s_WITB.dta'%i)\n",
    "\n",
    "    \n",
    "# Je dois travailler sur le code pour faire les minuscules à l'aide d'une loop\n",
    "public_pensions_parameters = pd.read_stata('public_pensions_parameters.dta')\n",
    "qpp_reform = pd.read_stata('QC/QPP_reform.dta')\n",
    "witb_qpp = pd.read_stata('QC/WITB_qpp.dta')\n",
    "fed_nrtc = pd.read_stata('CAN/fed_nrtc.dta')\n",
    "child_transf = pd.read_stata('CAN/child_transf.dta')\n",
    "gst = pd.read_stata('CAN/gst.dta')\n",
    "chcare_deduc = pd.read_stata('CAN/chcare_deduc.dta')\n",
    "chcare = pd.read_stata('QC/chcare.dta')\n",
    "qc_health_contribution = pd.read_stata('QC/QC_health_contribution_nofortran.dta')\n",
    "ramq_medic = pd.read_stata('QC/RAMQ_medic.dta')\n",
    "cap = pd.read_stata('QC/CAP.dta')\n",
    "rtc_sol = pd.read_stata('QC/rtc_sol.dta')\n",
    "rtc_sol2 = pd.read_stata('QC/rtc_sol2.dta')\n",
    "wp = pd.read_stata('QC/WP.dta')\n",
    "awp = pd.read_stata('QC/AWP.dta')\n",
    "work_deduct = pd.read_stata('QC/work_deduct.dta')\n",
    "nrtc_expworkert = pd.read_stata('QC/NRTC_expworkert.dta')\n",
    "qc_health_service_fund = pd.read_stata('QC/QC_health_service_fund.dta')\n",
    "on_health_contribution = pd.read_stata('ON/ON_health_contribution_nofortran.dta')\n",
    "gains_parameters = pd.read_stata('ON/GAINS_parameters_nofortran.dta')\n",
    "ocb_parameters = pd.read_stata('ON/OCB_parameters.dta')\n",
    "rtc_ost_parameters = pd.read_stata('ON/RTC_OST_parameters.dta')\n",
    "ontnec = pd.read_stata('ON/ONTNEC.dta')\n",
    "bcfb = pd.read_stata('BC/BCFB.dta')\n",
    "bceib = pd.read_stata('BC/BCEIB.dta')\n",
    "bcectb = pd.read_stata('BC/BCECTB.dta')\n",
    "bclicatc = pd.read_stata('BC/BCLICATC.dta')\n",
    "bcss = pd.read_stata('BC/BCSS_nofortran.dta')\n",
    "bcbts = pd.read_stata('BC/BCBTS.dta')\n",
    "bcstc = pd.read_stata('BC/BCSTC.dta')\n",
    "abfetc = pd.read_stata('AB/ABFETC.dta')\n",
    "absb = pd.read_stata('AB/ABSB.dta')\n",
    "abcb = pd.read_stata('AB/ABCB.dta')\n",
    "man55p = pd.read_stata('MAN/MAN55+_nofortran.dta')\n",
    "mancb = pd.read_stata('MAN/MANCB.dta')\n",
    "nbctb = pd.read_stata('NB/NBCTB.dta')\n",
    "nblisb = pd.read_stata('NB/NBLISB.dta')\n",
    "nlcb = pd.read_stata('NL/NLCB.dta')\n",
    "nlhstc = pd.read_stata('NL/NLHSTC.dta')\n",
    "nlsb = pd.read_stata('NL/NLSB.dta')\n",
    "nlis = pd.read_stata('NL/NLIS.dta')\n",
    "nscb = pd.read_stata('NS/NSCB.dta')\n",
    "nsaltc = pd.read_stata('NS/NSALTC.dta')\n",
    "nucb = pd.read_stata('NU/NUCB.dta')\n",
    "ntcb = pd.read_stata('NT/NTCB.dta')\n",
    "peistc = pd.read_stata('PEI/PEISTC.dta')\n",
    "sklitc = pd.read_stata('SK/SKLITC.dta')\n",
    "skes = pd.read_stata('SK/SKES.dta')\n",
    "sksip = pd.read_stata('SK/SKSIP_nofortran.dta')\n",
    "yucb = pd.read_stata('YU/YUCB.dta')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "list_df = [public_pensions_parameters, qpp_reform, witb_qpp, fed_nrtc, child_transf, gst, chcare_deduc,\\\n",
    "          chcare,qc_health_contribution, ramq_medic, cap, rtc_sol, rtc_sol2, wp, awp, work_deduct, \\\n",
    "           nrtc_expworkert, qc_health_service_fund, on_health_contribution, gains_parameters, \\\n",
    "          ocb_parameters, rtc_ost_parameters, ontnec, bcfb, bceib, bcectb, bclicatc, bcss, bcbts,\\\n",
    "           abfetc, absb, abcb, man55p, mancb, nbctb, nblisb, nlcb, nlhstc, nlsb, nlis, nscb, \\\n",
    "           nsaltc, nucb, ntcb, peistc, sklitc, skes, sksip, yucb]\n",
    "\n",
    "\n",
    "df_multiple = [param, soc_ass, soc_sol, witb]\n",
    "for i in range (first_year, end_year):\n",
    "    for v in range(len(df_multiple)):\n",
    "        list_df.append(df_multiple[v]['%s'%i])\n",
    "\n",
    "\n",
    "for v in range(len(list_df)):\n",
    "    list_df[v].columns = map(str.lower, list_df[v].columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     year  sklitc_base_single  sklitc_base_partner  sklitc_base_ch  \\\n",
      "0  2011.0               226.0                226.0            88.0   \n",
      "1  2012.0               232.0                232.0            90.0   \n",
      "2  2013.0               237.0                237.0            92.0   \n",
      "3  2014.0               239.0                239.0            93.0   \n",
      "4  2015.0               243.0                243.0            95.0   \n",
      "5  2016.0               246.0                246.0            96.0   \n",
      "\n",
      "   sklitc_redrate  sklitc_redstart  sklitc_stop  \n",
      "0            0.02          29619.0      61376.0  \n",
      "1            0.02          30465.0      62604.0  \n",
      "2            0.02          31056.0      63856.0  \n",
      "3            0.02          31342.0      64442.0  \n",
      "4            0.02          31878.0      65677.0  \n",
      "5            0.02          32301.0      66500.0  \n"
     ]
    }
   ],
   "source": [
    "print(sklitc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
